/**
 * 严肃声明：
 * 开源版本请务必保留此注释头信息，若删除我方将保留所有法律责任追究！
 * 本软件已申请软件著作权，受国家版权局知识产权以及国家计算机软件著作权保护！
 * 可正常分享和学习源码，不得用于违法犯罪活动，违者必究！
 * Copyright (c) 2019-2021 十三 all rights reserved.
 * 版权所有，侵权必究！
 */
package ltd.newbee.mall.service;

import ltd.newbee.mall.api.admin.param.BatchIdSendParam;
import ltd.newbee.mall.api.mall.param.BillInputParam;
import ltd.newbee.mall.api.mall.param.InvoiceApplyParam;
import ltd.newbee.mall.api.mall.param.RefundApplyParam;
import ltd.newbee.mall.api.mall.vo.NewBeeMallOrderDetailVO;
import ltd.newbee.mall.api.mall.vo.NewBeeMallOrderItemVO;
import ltd.newbee.mall.api.mall.vo.NewBeeMallShoppingCartItemVO;
import ltd.newbee.mall.entity.MallUser;
import ltd.newbee.mall.entity.MallUserAddress;
import ltd.newbee.mall.entity.NewBeeMallOrder;
import ltd.newbee.mall.util.PageQueryUtil;
import ltd.newbee.mall.util.PageResult;
import ltd.newbee.mall.util.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface NewBeeMallOrderService {

    /**
     * 查询超时未支付的订单ID列表
     * @param status 订单状态
     * @param overtimeMinutes 超时分钟数
     * @return 订单ID列表
     */


    /**
     * 获取订单详情
     *
     * @param orderId
     * @return
     */
    NewBeeMallOrderDetailVO getOrderDetailByOrderId(Long orderId);

    /**
     * 获取订单详情
     *
     * @param orderNo
     * @param userId
     * @return
     */
    NewBeeMallOrderDetailVO getOrderDetailByOrderNo(String orderNo, Long userId);


    NewBeeMallOrderDetailVO getAdminOrderDetailByOrderNo(String orderNo);


    /**
     * 我的订单列表
     *
     * @param pageUtil
     * @return
     */
    PageResult getMyOrders(PageQueryUtil pageUtil);

    void autoCancelOvertimeOrders();

    /**
     * 手动取消订单
     *
     * @param orderNo
     * @param userId
     * @return
     */
    String cancelOrder(String orderNo, Long userId);

    /**
     * 确认收货
     *
     * @param orderNo
     * @param userId
     * @return
     */
    String finishOrder(String orderNo, Long userId);

    String paySuccess(String orderNo, int payType);

    String saveOrder(MallUser loginMallUser, MallUserAddress address, List<NewBeeMallShoppingCartItemVO> myShoppingCartItems, BigDecimal deliveryFee, Integer deliveryType, String userAddress, String pickupAddress);

    /**
     * 后台分页
     *
     * @param pageUtil
     * @return
     */
    PageResult getNewBeeMallOrdersPage(PageQueryUtil pageUtil);



    /**
     * 订单信息修改
     *
     * @param newBeeMallOrder
     * @return
     */
    String updateOrderInfo(NewBeeMallOrder newBeeMallOrder);
    String updateByPrimaryKeySelective(NewBeeMallOrder newBeeMallOrder);



    /**
     * 配货
     *
     * @param ids
     * @return
     */
    String checkDone(Long[] ids);

    /**
     * 出库
     *
     * @param ids
     * @return
     */
    String checkOut(BatchIdSendParam batchIdParam);

    /**
     * 关闭订单
     *
     * @param ids
     * @return
     */
    String closeOrder(Long[] ids);

    String refundOrder(String orderNo);

    String refundYwyOrder(String orderNo);




    Result newBill(BillInputParam billInputParam);

    Result applyRefund(RefundApplyParam refundApplyParam);

    Result approveInvoice(InvoiceApplyParam invoiceApplyParam);


    Result applyInvoice(InvoiceApplyParam invoiceApplyParam);


    Result selectBill(String orderNo);





    List<NewBeeMallOrderItemVO> getOrderItems(Long orderId);
}
